<template>
  <div>
    <div class="right-content">
      <el-form :model="dataFormUpload">
        <el-row :gutter="15">
        <el-form-item label="主题" style="width: 370px;" prop="title" auto-complete="on">
          <el-input v-model="dataFormUpload.title" ></el-input>
        </el-form-item>
        <el-form-item label="上传人工号" style="width: 370px;" prop="workID" auto-complete="on">
          <el-input v-model="dataFormUpload.workID" ></el-input>
        </el-form-item>
        <el-form-item label="主要描述" style="width: 370px;" prop="description" auto-complete="on">
          <el-input v-model="dataFormUpload.description" ></el-input>
        </el-form-item>
        <el-form-item>
          <el-upload
          ref="upload"
          class="upload-demo"
          action="/process/processFile"
          :data="dataFormUpload"
          :on-success="upFile"
          :auto-upload="false"
          :file-list="fileList"
          :headers="header">
          <el-button  slot="trigger" size="small" type="primary">选择文件</el-button>
          <el-button @click="submitForm">保存</el-button>
        </el-upload>
        </el-form-item>
      </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Test',
  data() {
    return {
      dataFormUpload: {
        title: '123',
        workID: '123',
        description: '内容'
      },
      fileList: '',
      authentication: ''
    }
  },
  mounted() {
    this.authentication = sessionStorage.getItem('tokenStr')
  },
  computed: {
    header() {
      return {
        authentication: this.authentication
      }
    }
  },
  methods: {
    upFile(res, file) {
      console.log(res)
    },
    submitForm() {
      this.$refs.upload.submit()
    },
    returnValue() {
      return {
        token: sessionStorage.getItem('tokenStr')
      }
    }
  }
}
</script>

